#include <iostream>
#include <vector>
using namespace std;

int main() {
    vector<vector<long long>> matrix;
    int width; cin >> width;
    matrix.resize(width, vector<long long>());
    for (int i = 0; i < width; i++) {
        matrix[i].resize(width, 0);
        for (int j = 0; j < width; j++) {
            long long curr; cin >> curr;
            matrix[i][j] = curr;
        }
    }
    // 初始化矩阵
    long long result = 0;
    // 右下斜线累乘相加
    for (int xSwift = 0; xSwift < width; xSwift++) {
        long long currResult = 1;
        for (int index = 0; index < width; index++) {
            currResult *= matrix[index][(index + xSwift) % width];
        }
        result += currResult;
    }
    // 右上斜线累乘相减
    for (int xSwift = 0; xSwift < width; xSwift++) {
        long long currResult = 1;
        for (int index = 0; index < width; index++) {
            currResult *= matrix[width - index - 1][(index + xSwift) % width];
        }
        result -= currResult;
    }
    cout << result;
    return 0;
}